package com.lianzhihui.minitiktok.ui.main.two

import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.echofeng.common.ui.base.BaseFragment
import com.lianzhihui.minitiktok.adapter.hot.GoldOneAdapter
import com.lianzhihui.minitiktok.bean.hot.HotClassResponse
import com.lianzhihui.minitiktok.bean.hot.VideoResponse
import com.lianzhihui.minitiktok.presenter.HomePresnterImp
import com.lianzhihui.minitiktok.view.HomeView
import com.lianzhihui.onlyleague.R
import kotlinx.android.synthetic.main.fragment_gold_one.*

/**
 * A simple [Fragment] subclass.
 * Use the [GoldOneFragment.newInstance] factory method to
 * create an instance of this fragment.
 */
class GoldOneFragment : BaseFragment() ,HomeView{

    private lateinit var homePresnterImp: HomePresnterImp
    private lateinit var adapter: GoldOneAdapter

    override fun getLayoutId(): Int {
        return R.layout.fragment_gold_one
    }

    override fun initView() {
        adapter = GoldOneAdapter(ArrayList())
        val layoutManager = LinearLayoutManager(context)
        layoutManager.orientation = RecyclerView.VERTICAL
        mRecyclerView.setLayoutManager(layoutManager)
        mRecyclerView.setAdapter(adapter)
    }

    override fun initData() {
        homePresnterImp = HomePresnterImp(context,this);
        homePresnterImp.getHotGoldVideo(pageNum)
    }

    override fun setSuccess(o: Any?) {
    }

    override fun setFailure(o: Any?) {
    }

    override fun setVideoRecommendSuccess(data: MutableList<VideoResponse>?) {
    }

    override fun setSearchVideoSuccess(data: MutableList<VideoResponse>?) {
        adapter.setNewData(data)
    }


    override fun setHotClassSuccess(data: MutableList<HotClassResponse>?) {
    }

}